package com.yxkj.syh.app.huarong.activities.account.login.ver;

import android.content.Context;
import android.os.Bundle;

import com.syh.app.basic.base.BaseFragment;
import com.yxkj.syh.app.huarong.BR;
import com.yxkj.syh.app.huarong.R;
import com.yxkj.syh.app.huarong.databinding.FragmentVerCodeLoginBinding;

/**
 * 验证码登录
 */
public class VerCodeLoginFragment extends BaseFragment<FragmentVerCodeLoginBinding, VerCodeLoginVM> {

    private OnFragmentListener mListener;

    public VerCodeLoginFragment() {
        // Required empty public constructor
    }

    public static VerCodeLoginFragment newInstance() {
        VerCodeLoginFragment fragment = new VerCodeLoginFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context instanceof OnFragmentListener) {
            mListener = (OnFragmentListener) context;
        } else {
            throw new RuntimeException(context.toString()
                    + " must implement OnFragmentListener");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    @Override
    protected int getViewModelId() {
        return BR.verCodeLoginVM;
    }

    @Override
    protected int getContentLayout() {
        return R.layout.fragment_ver_code_login;
    }

    @Override
    protected void initView() {
        mVDBinding.btnPwdLogin.setOnClickListener(v -> {
            if (mListener != null) {
                mListener.onPwdLogin();
            }
        });
    }


    public interface OnFragmentListener {
        void onPwdLogin();
    }
}
